package com.store.pet.petstore.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.squareup.picasso.Picasso;
import com.store.pet.petstore.R;
import com.store.pet.petstore.bean.PetListBean;

import java.util.List;

public class InStockAdapter extends BaseQuickAdapter<PetListBean.ContentBean.PetlistBean,BaseViewHolder> {

    public InStockAdapter(int layoutResId, @Nullable List<PetListBean.ContentBean.PetlistBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, PetListBean.ContentBean.PetlistBean item) {
        helper.setText(R.id.instock_item_name,item.getName());
        helper.setText(R.id.instock_item_price,String.valueOf(item.getPrice()));
        ImageView imageView = helper.getView(R.id.instock_item_img);
        Picasso.with(mContext).load(item.getImg()).into(imageView);
        helper.addOnClickListener(R.id.instock_item);
    }
}
